package com.study.util;

/**
 * @author 朱天乐
 */
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import java.io.File;

public class XmlValidator {
    public static void main(String[] args) {
        try {
            File xmlFile = new File("C:\\campus-course-management-system\\course_management_system\\target\\classes\\mapper\\TeachercourseMapper.xml");
            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
            Document doc = dBuilder.parse(xmlFile);
            System.out.println("XML 文件解析成功");
        } catch (Exception e) {
            System.out.println("XML 文件解析失败: " + e.getMessage());
            e.printStackTrace();
        }
    }
}